//
//  PlayVideoTableViewCell.m
//  GC_OC
//
//  Created by wlf on 2022/5/16.
//

#import "PlayVideoTableViewCell.h"
#import "SDWebImage.h"
@implementation PlayVideoTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.titleLab = [[UILabel alloc] initWithFrame:CGRectMake(30, 0, 200, 50)];
        self.titleLab.font = [UIFont boldSystemFontOfSize:17];
        self.titleLab.textColor = [UIColor whiteColor];
        self.subTitleLab = [[UILabel alloc] initWithFrame:CGRectMake(SCREEN_WIDTH - 100, 0, 80, 50)];
        self.subTitleLab.textAlignment = NSTextAlignmentRight;
        self.subTitleLab.font = [UIFont systemFontOfSize:12];
        self.subTitleLab.textColor = [UIColor colorWithHex:@"#BFBFBF"];
        [self.contentView addSubview:self.titleLab];
        [self.contentView addSubview:self.subTitleLab];
        
        self.topImgV = [[UIImageView alloc] initWithFrame:CGRectMake(5,16, 18, 18)];
        self.topImgV.image = [UIImage imageNamed:@"icon_playIcon"];
        [self.contentView addSubview:self.topImgV];
        self.topImgV.hidden = YES;
        
        
        self.playIconV = [[UIImageView alloc] initWithFrame:CGRectMake(SCREEN_WIDTH - 90 ,16, 18, 18)];
         
        NSString *filePath = [[NSBundle bundleWithPath:[[NSBundle mainBundle] bundlePath]] pathForResource:@"videoPlay" ofType:@"gif"];
        NSData *imageData = [NSData dataWithContentsOfFile:filePath];
        self.playIconV.image = [UIImage sd_imageWithGIFData:imageData];
        [self.contentView addSubview:self.playIconV];
        self.playIconV.hidden = YES;
    }
    return self;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    if (selected) {
        
        self.topImgV.hidden = NO;
        self.titleLab.frame = CGRectMake(33, 0, 200, 50);
        self.playIconV.hidden = NO;
        self.subTitleLab.font =  [UIFont systemFontOfSize:12];
        self.backgroundColor =  [UIColor colorWithHex:@"#283A43"];
    }else{

        self.topImgV.hidden = YES;
        self.titleLab.frame = CGRectMake(30, 0, 200, 50);
        self.playIconV.hidden = YES;
        self.subTitleLab.font =  [UIFont systemFontOfSize:12];
        self.backgroundColor =  [UIColor clearColor];
    }
}



@end
